<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<div id="section_pages">
  <h2>
    <%= @category.name %>
    <% if can_do(@portfolio, @current_user, :manage) %>
    <div style="float: right; margin-right: 10px; font-size: 0.8em;">
      <a href="#" class="manage_pages_link" style="font-style: italic;" title="{{#t}}Add, remove or rearrange pages for this section{{/t}}"><%= manage_pages_link_text %></a>
    </div>
    <% end %>
  </h2>
  <div>
    <div class="editing_box" style="font-size: 0.8em;">
      {{#t}}Rename or reorder a page via the settings menu next to the page name. Alternatively, click a page's name to rename it or drag a page's name to reorder it.{{/t}}

    </div>
    <div class="displaying_box" style="font-size: 0.8em;">
      {{#t}}Pages for this section{{/t}}
    </div>
    <ul id="page_list">
      <% @category.eportfolio_entries.each do |e| %>
        <li id="page_<%= e.id %>" class="page <%= "current" if e == @page %>">
          <a class="page_url edit_page_link no-hover" href="<%= @category.slug.presence && e.slug.presence && eportfolio_named_category_entry_path(@portfolio, @category.slug, e.slug) %>">
            <span class="name"><%= e.name %></span>
          </a>
          <a class="rename_page_url" href="<%= eportfolio_entry_path(@portfolio, e.id) %>" style="display: none;">&nbsp;</a>
          &nbsp;
          {{> views/eportfolios/page_settings}}
        </li>
      <% end %>
      <li id="page_blank" class="page unsaved" style="display: none;">
        <a class="page_url edit_page_link no-hover" href="<%= @category.slug.presence && eportfolio_named_category_entry_path(@portfolio, @category.slug, "{{ slug }}") %>">
          <span class="name">{{#t}}Page Name{{/t}}</span>
        </a>
        <a class="rename_page_url" href="<%= eportfolio_entry_path(@portfolio, "{{ id }}") %>" style="display: none;">&nbsp;</a>
        &nbsp;
        {{> views/eportfolios/page_settings", locals: { title: t("Page Name}}
      </li>
    </ul>
    <a href="#" class="add_page_link icon-add">{{#t}}Add Another Page{{/t}}</a>
    <div class="editing_box button-container">
      <button type="button" class="done_editing_button btn btn-primary">{{#t}}Done Editing{{/t}}</button>
    </div>
    <a href="<%= eportfolio_entries_path(@portfolio) %>" class="add_page_url" style="display: none;">&nbsp;</a>
    <a href="<%= eportfolio_reorder_entries_url(@portfolio.id, @category.id) %>" class="reorder_pages_url" style="display:none;">&nbsp;</a>
  </div>
</div>
<span id="page_name_holder" style="display: none;">
<input type="text" id="page_name"/>
</span>
